{% extends "base.html" %}
{% block title %}自动计算最优rssi及最优客流判断时长{% endblock %}
{% block head_script_block %}

{% endblock %}
{% block body_content_block %}
<div class="row-fluid">

    <div class="span12">
        <button class="btn" type="button" onclick="javascript:history.go(-1)">返回</button>
        {% for retMsg in retMsgs %}
        <p>{{ retMsg }}</p>

        {% endfor %}
        {% if expect_datas %}
        <table>
            <tr>
                <th>日期</th>
                <th>入店量</th>
                <th>客流量</th>
            </tr>
            {% for expect_data in expect_datas %}
            <tr>
                <td>{{ expect_data.day }}</td>
                <td>{{ expect_data.customer }}</td>
                <td>{{ expect_data.flow }}</td>
            </tr>

            {% endfor %}
        </table>
        {% endif %}

        {% if all_datas %}
        <table width="400%" border="1" cellpadding="2" cellspacing="0">
            <tr>
                <th rowspan="4">日期</th>
                <th rowspan="4">实际入店量</th>
                <th rowspan="4">实际客流量</th>
                <th colspan="100">rssi范围</th>
            </tr>

            <tr>
                {% for rssi in rssiList %}
                <th colspan="3">{{ rssi }}</th>
                {% endfor %}
            </tr>
            <tr>
                {% for rssi in rssiList %}
                <th colspan="2">入店量</th>

                <th rowspan="2">客流量</th>


                {% endfor %}
            </tr>
            <tr>
                {% for rssi in rssiList %}
                <th>1分钟</th>
                <th>2分钟</th>
                {% endfor %}
            </tr>
            {% for all_data in all_datas|dictsort:"day" %}
            <tr>
                <th>{{ all_data.day }}</th>
                {% for rday ,customer in real_customer.iteritems %}
                {% ifequal rday all_data.day %}
                <td><font size="3" color="green">{{ customer }}</font></td>
                {% endifequal %}
                {% endfor %}
                {% for rday ,flow in real_flow.iteritems %}
                {% ifequal rday all_data.day %}
                <td><font size="3" color="green">{{ flow }}</font></td>
                {% endifequal %}
                {% endfor %}
                {% for rssi,rdatas  in all_data.data.iteritems %}
                {% ifequal rssi expect_customer_rssi %}
                {% ifequal expect_customer_walkby 60 %}
                <td><font size="3" color="red">{{ rdatas.all_customer.60 }}</font></td>
                <td>{{ rdatas.all_customer.120 }}</td>
                {% else %}
                <td>{{ rdatas.all_customer.60 }}</td>
                <td><font size="3" color="red">{{ rdatas.all_customer.120 }}</font></td>
                {% endifequal %}
                {% else %}
                <td>{{ rdatas.all_customer.60 }}</td>
                <td>{{ rdatas.all_customer.120 }}</td>
                {% endifequal %}
                {% ifequal rssi expect_flow_rssi %}
                <td><font size="3" color="red">{{ rdatas.all_flow }}</font></td>
                {% else %}
                <td>{{ rdatas.all_flow }}</td>
                {% endifequal %}
                {% endfor %}
            </tr>

            {% endfor %}
        </table>
        {% endif %}
        <br/>
    </div>
</div>

{% endblock %}
